// 本文件由自动工具 proto.py 自动生成，请勿修改
// filename msg5000_csbuf.ts
// package ptl


// message OpenCardMJ
export class OpenCardMJ {
	protoid: number = 0;
	key: number = 0;
	value: number = 0;


Marshal(writer: any) {
	writer.setUint8(this.key, 1)
	writer.setUint8(this.value, 2)
}

Unmarshal(reader: any) {
	this.key = reader.getUint8(1)
	this.value = reader.getUint8(2)
}
}

// message PlayerInfoMJ
export class PlayerInfoMJ {
	protoid: number = 0;
	playerId: string = "";
	score: number = 0;
	cards: number[] = [];
	discards: number[] = [];
	opencards: OpenCardMJ[] = [];


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setInt32(this.score, 2)
	writer.setArray(this.cards.length, 3)
	for (let v of this.cards) {
		writer.setUint8(v, 0)
	}
	writer.setArray(this.discards.length, 4)
	for (let v of this.discards) {
		writer.setUint8(v, 0)
	}
	writer.setArray(this.opencards.length, 5)
	for (let v of this.opencards) {
		writer.setMessage(0)
		v.Marshal(writer)
		writer.endSetMessage()
	}
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	this.score = reader.getInt32(2)
	let countCards = reader.getArray(3)
	for (let i=0; i < countCards; i++) {
		this.cards.push(reader.getUint8(0))
	}
	let countDiscards = reader.getArray(4)
	for (let i=0; i < countDiscards; i++) {
		this.discards.push(reader.getUint8(0))
	}
	let countOpencards = reader.getArray(5)
	for (let i=0; i < countOpencards; i++) {
		let msg = new OpenCardMJ()
		reader.getMessage(0)
		msg.Unmarshal(reader)
		reader.endGetMessage()
		this.opencards.push(msg)
	}
}
}

// message HandPatternMj
export class HandPatternMj {
	protoid: number = 0;
	playerId: string = "";
	hps: number[] = [];


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setArray(this.hps.length, 2)
	for (let v of this.hps) {
		writer.setUint16(v, 0)
	}
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	let countHps = reader.getArray(2)
	for (let i=0; i < countHps; i++) {
		this.hps.push(reader.getUint16(0))
	}
}
}

// message GameInfoMJ
export class GameInfoMJ {
	protoid: number = 5000;
	roomId: number = 0;
	players: PlayerInfoMJ[] = [];
	ghost: number = 0;
	actor: string = "";
	banker: string = "";
	round: number = 0;
	count: number = 0;
	cardCount: number = 0;
	lastActor: string = "";
	lastCard: number = 0;
	startTime: number = 0;


Marshal(writer: any) {
	writer.setUint32(this.roomId, 1)
	writer.setArray(this.players.length, 2)
	for (let v of this.players) {
		writer.setMessage(0)
		v.Marshal(writer)
		writer.endSetMessage()
	}
	writer.setUint8(this.ghost, 3)
	writer.setString(this.actor, 4)
	writer.setString(this.banker, 5)
	writer.setUint16(this.round, 6)
	writer.setUint16(this.count, 7)
	writer.setUint16(this.cardCount, 8)
	writer.setString(this.lastActor, 9)
	writer.setUint8(this.lastCard, 10)
	writer.setInt64(this.startTime, 11)
}

Unmarshal(reader: any) {
	this.roomId = reader.getUint32(1)
	let countPlayers = reader.getArray(2)
	for (let i=0; i < countPlayers; i++) {
		let msg = new PlayerInfoMJ()
		reader.getMessage(0)
		msg.Unmarshal(reader)
		reader.endGetMessage()
		this.players.push(msg)
	}
	this.ghost = reader.getUint8(3)
	this.actor = reader.getString(4)
	this.banker = reader.getString(5)
	this.round = reader.getUint16(6)
	this.count = reader.getUint16(7)
	this.cardCount = reader.getUint16(8)
	this.lastActor = reader.getString(9)
	this.lastCard = reader.getUint8(10)
	this.startTime = reader.getInt64(11)
}
}

// message GameScoreInfo
export class GameScoreInfo {
	protoid: number = 0;
	playerId: string = "";
	score: number = 0;
	cards: number[] = [];
	openKong: number = 0;
	selfKong: number = 0;
	eatKong: number = 0;
	putKong: number = 0;


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setInt32(this.score, 2)
	writer.setArray(this.cards.length, 3)
	for (let v of this.cards) {
		writer.setUint8(v, 0)
	}
	writer.setUint8(this.openKong, 4)
	writer.setUint8(this.selfKong, 5)
	writer.setUint8(this.eatKong, 6)
	writer.setUint8(this.putKong, 7)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	this.score = reader.getInt32(2)
	let countCards = reader.getArray(3)
	for (let i=0; i < countCards; i++) {
		this.cards.push(reader.getUint8(0))
	}
	this.openKong = reader.getUint8(4)
	this.selfKong = reader.getUint8(5)
	this.eatKong = reader.getUint8(6)
	this.putKong = reader.getUint8(7)
}
}

// message GameResultInfo
export class GameResultInfo {
	protoid: number = 0;
	playerId: string = "";
	score: number = 0;
	openKong: number = 0;
	selfKong: number = 0;
	maCount: number = 0;
	winCount: number = 0;
	eatKong: number = 0;
	putKong: number = 0;


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setInt32(this.score, 2)
	writer.setUint8(this.openKong, 3)
	writer.setUint8(this.selfKong, 4)
	writer.setUint8(this.maCount, 5)
	writer.setUint8(this.winCount, 6)
	writer.setUint8(this.eatKong, 7)
	writer.setUint8(this.putKong, 8)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	this.score = reader.getInt32(2)
	this.openKong = reader.getUint8(3)
	this.selfKong = reader.getUint8(4)
	this.maCount = reader.getUint8(5)
	this.winCount = reader.getUint8(6)
	this.eatKong = reader.getUint8(7)
	this.putKong = reader.getUint8(8)
}
}

// message Resp5001
export class Resp5001 {
	protoid: number = 5001;
	gameInfo = new GameInfoMJ();


Marshal(writer: any) {
	writer.setMessage(1)
	this.gameInfo.Marshal(writer)
	writer.endSetMessage()
}

Unmarshal(reader: any) {
	reader.getMessage(1)
	this.gameInfo.Unmarshal(reader)
	reader.endGetMessage()
}
}

// message Resp5002
export class Resp5002 {
	protoid: number = 5002;
	roomId: number = 0;
	scores: GameResultInfo[] = [];


Marshal(writer: any) {
	writer.setUint32(this.roomId, 1)
	writer.setArray(this.scores.length, 3)
	for (let v of this.scores) {
		writer.setMessage(0)
		v.Marshal(writer)
		writer.endSetMessage()
	}
}

Unmarshal(reader: any) {
	this.roomId = reader.getUint32(1)
	let countScores = reader.getArray(3)
	for (let i=0; i < countScores; i++) {
		let msg = new GameResultInfo()
		reader.getMessage(0)
		msg.Unmarshal(reader)
		reader.endGetMessage()
		this.scores.push(msg)
	}
}
}

// message Req5003
export class Req5003 {
	protoid: number = 5003;
	playerId: string = "";
	option: number = 0;


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setUint8(this.option, 2)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	this.option = reader.getUint8(2)
}
}

// message Resp5003
export class Resp5003 {
	protoid: number = 5003;
	roomId: number = 0;
	winner: string[] = [];
	scores: GameScoreInfo[] = [];
	mas: number[] = [];
	option: number = 0;
	cards: number[] = [];
	isEnd: boolean = false;
	hps: HandPatternMj[] = [];


Marshal(writer: any) {
	writer.setUint32(this.roomId, 1)
	writer.setArray(this.winner.length, 2)
	for (let v of this.winner) {
		writer.setString(v, 0)
	}
	writer.setArray(this.scores.length, 3)
	for (let v of this.scores) {
		writer.setMessage(0)
		v.Marshal(writer)
		writer.endSetMessage()
	}
	writer.setArray(this.mas.length, 4)
	for (let v of this.mas) {
		writer.setUint8(v, 0)
	}
	writer.setUint8(this.option, 5)
	writer.setArray(this.cards.length, 6)
	for (let v of this.cards) {
		writer.setUint8(v, 0)
	}
	writer.setBool(this.isEnd, 7)
	writer.setArray(this.hps.length, 8)
	for (let v of this.hps) {
		writer.setMessage(0)
		v.Marshal(writer)
		writer.endSetMessage()
	}
}

Unmarshal(reader: any) {
	this.roomId = reader.getUint32(1)
	let countWinner = reader.getArray(2)
	for (let i=0; i < countWinner; i++) {
		this.winner.push(reader.getString(0))
	}
	let countScores = reader.getArray(3)
	for (let i=0; i < countScores; i++) {
		let msg = new GameScoreInfo()
		reader.getMessage(0)
		msg.Unmarshal(reader)
		reader.endGetMessage()
		this.scores.push(msg)
	}
	let countMas = reader.getArray(4)
	for (let i=0; i < countMas; i++) {
		this.mas.push(reader.getUint8(0))
	}
	this.option = reader.getUint8(5)
	let countCards = reader.getArray(6)
	for (let i=0; i < countCards; i++) {
		this.cards.push(reader.getUint8(0))
	}
	this.isEnd = reader.getBool(7)
	let countHps = reader.getArray(8)
	for (let i=0; i < countHps; i++) {
		let msg = new HandPatternMj()
		reader.getMessage(0)
		msg.Unmarshal(reader)
		reader.endGetMessage()
		this.hps.push(msg)
	}
}
}

// message Req5004
export class Req5004 {
	protoid: number = 5004;
	playerId: string = "";
	opencard = new OpenCardMJ();
	eatcard: number = 0;


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setMessage(2)
	this.opencard.Marshal(writer)
	writer.endSetMessage()
	writer.setUint8(this.eatcard, 3)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	reader.getMessage(2)
	this.opencard.Unmarshal(reader)
	reader.endGetMessage()
	this.eatcard = reader.getUint8(3)
}
}

// message Resp5004
export class Resp5004 {
	protoid: number = 5004;
	playerId: string = "";
	opencard = new OpenCardMJ();
	card: number = 0;


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setMessage(2)
	this.opencard.Marshal(writer)
	writer.endSetMessage()
	writer.setUint8(this.card, 3)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	reader.getMessage(2)
	this.opencard.Unmarshal(reader)
	reader.endGetMessage()
	this.card = reader.getUint8(3)
}
}

// message Req5005
export class Req5005 {
	protoid: number = 5005;
	playerId: string = "";
	index: number = 0;
	card: number = 0;


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setUint8(this.index, 2)
	writer.setUint8(this.card, 3)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	this.index = reader.getUint8(2)
	this.card = reader.getUint8(3)
}
}

// message Resp5005
export class Resp5005 {
	protoid: number = 5005;
	playerId: string = "";
	index: number = 0;
	card: number = 0;
	eatIds: string[] = [];


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setUint8(this.index, 2)
	writer.setUint8(this.card, 3)
	writer.setArray(this.eatIds.length, 4)
	for (let v of this.eatIds) {
		writer.setString(v, 0)
	}
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	this.index = reader.getUint8(2)
	this.card = reader.getUint8(3)
	let countEatIds = reader.getArray(4)
	for (let i=0; i < countEatIds; i++) {
		this.eatIds.push(reader.getString(0))
	}
}
}

// message Req5006
export class Req5006 {
	protoid: number = 5006;
	playerId: string = "";


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
}
}

// message Resp5006
export class Resp5006 {
	protoid: number = 5006;
	playerId: string = "";


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
}
}

// message Req5007
export class Req5007 {
	protoid: number = 5007;
	playerId: string = "";
	card: number = 0;


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setUint8(this.card, 2)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	this.card = reader.getUint8(2)
}
}

// message Resp5007
export class Resp5007 {
	protoid: number = 5007;
	playerId: string = "";
	opencard = new OpenCardMJ();
	card: number = 0;
	rob: boolean = false;
	robIds: string[] = [];


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setMessage(2)
	this.opencard.Marshal(writer)
	writer.endSetMessage()
	writer.setUint8(this.card, 3)
	writer.setBool(this.rob, 4)
	writer.setArray(this.robIds.length, 5)
	for (let v of this.robIds) {
		writer.setString(v, 0)
	}
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	reader.getMessage(2)
	this.opencard.Unmarshal(reader)
	reader.endGetMessage()
	this.card = reader.getUint8(3)
	this.rob = reader.getBool(4)
	let countRobIds = reader.getArray(5)
	for (let i=0; i < countRobIds; i++) {
		this.robIds.push(reader.getString(0))
	}
}
}

// message Resp5010
export class Resp5010 {
	protoid: number = 5010;
	playerId: string = "";
	card: number = 0;
	round: number = 0;
	cardCount: number = 0;


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setUint8(this.card, 2)
	writer.setUint16(this.round, 3)
	writer.setUint16(this.cardCount, 4)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	this.card = reader.getUint8(2)
	this.round = reader.getUint16(3)
	this.cardCount = reader.getUint16(4)
}
}

// message Req5011
export class Req5011 {
	protoid: number = 5011;
	playerId: string = "";


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
}
}

// message Resp5011
export class Resp5011 {
	protoid: number = 5011;
	playerId: string = "";


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
}
}

// message Resp5012
export class Resp5012 {
	protoid: number = 5012;
	playerId: string = "";


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
}
}

